//
//  GHSAD_FailTableViewCell.m
//  penzer
//
//  Created by 还带大道 on 2018/11/23.
//  Copyright © 2018年 caiyc. All rights reserved.
//

#import "GHSAD_FailTableViewCell.h"

@interface GHSAD_FailTableViewCell()
@property (weak, nonatomic) IBOutlet UIView *bgV;
@property (weak, nonatomic) IBOutlet UILabel *number;
@property (weak, nonatomic) IBOutlet UILabel *time;
@property (weak, nonatomic) IBOutlet UILabel *desc;

@end
@implementation GHSAD_FailTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    //设置阴影
    _bgV.backgroundColor = [UIColor whiteColor];
    _bgV.layer.shadowColor = RZ_COLOR_ALPHA(0, 0, 0, 0.1).CGColor;
    _bgV.layer.cornerRadius = 5;
    _bgV.layer.shadowOffset = CGSizeMake(0,4);
    _bgV.layer.shadowOpacity = 1;
    _bgV.layer.shadowRadius = 15;
    
    [self setupDesc];
}


- (void)setupDesc
{
    NSString *name = @"**芝";
    NSString *resStr = @"支持供货商决定，申诉不成功";
    if(name && name.length>0){
        NSMutableAttributedString *attributeStr = [NSMutableAttributedString new] ;
        NSAttributedString *as1 = [[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@"驳回买家（%@）的申诉，",name] attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:12],NSForegroundColorAttributeName:RZ_COLOR(51, 51, 51)}];
        [attributeStr appendAttributedString:as1];
        
        
        NSAttributedString *as2 = [[NSAttributedString alloc] initWithString:resStr attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:12],NSForegroundColorAttributeName:RZ_COLOR(54, 212, 117)}];
        [attributeStr appendAttributedString:as2];
        
        //段落样式
        NSMutableParagraphStyle *paragraph = [[NSMutableParagraphStyle alloc] init];
        paragraph.lineSpacing = 5; //设置行间距
        paragraph.alignment = NSTextAlignmentLeft;
        NSDictionary *attributeDict = @{NSKernAttributeName:@0,//字符间距
                                        NSParagraphStyleAttributeName:paragraph};
        
        [attributeStr addAttributes:attributeDict range:NSMakeRange(0, attributeStr.length)];
        _desc.attributedText = attributeStr;
    }
}



- (void)layoutSubviews
{
    [super layoutSubviews];
    [self.contentView layoutIfNeeded];
    self.bgV.layer.shadowPath = [UIBezierPath bezierPathWithRect:_bgV.bounds].CGPath;
}


@end
